package com.ad.payload.model;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.util.List;

@Data
public class PageView<T> {

    /**
     * 数据总条数
     */
    private Long totalCount;

    /**
     * 数据列表
     */
    private List<T> pageList;

    /**
     * 页码
     */
    private Long pageNo;

    /**
     * 页大小
     */
    private Long pageSize;

    /**
     * 总页数
     */
    private Long totalPages;

    public PageView() {
    }

    public PageView(IPage<T> iPage) {
            this.totalCount = iPage.getTotal();
            this.pageList = iPage.getRecords();
            this.pageNo = iPage.getCurrent();
            this.pageSize = iPage.getSize();
            this.totalPages = iPage.getPages();
    }
}
